import axios from '@/libs/api.request'

export const login = ({ userName, password }) => { 
  const data = {
    userName,
    password
  }
  return axios.request({
    // url: 'login',
    url: '/users/session',
    data,
    method: 'post'
  })
}

export const getUserInfo = (token) => {
  return axios.request({
    url: 'get_info',
    params: {
      token
    },
    method: 'get'
  })
}

export const logout = (token) => {  
  return axios.request({
    url: 'logout',
    method: 'post'
  })
}
export const getTableMsg = (token, param) => {
  const data = {param}
  return axios.request({
    url: '/project/task',
    data,
    method: 'post'
  })
}

export const getOptionsMsg = (token) => {
  return axios.request({
    url: '/archives/select',
    method: 'get'
  })
}
export const getaskTableMsg = (token, param) => {
  const data = {param}
  return axios.request({
    url: '/project/issue',
    data,
    method: 'post'
  })
}
export const getminTableMsg = (token, param) => {
  const type = param.type
  return axios.request({
    url: '/archives/' + type,
    method: 'get'
  })
}
export const adTableMsg = (token, param) => {
  const data = {param}
  const type = param.type
  return axios.request({
    url: '/archives/update/' + type,
    data,
    method: 'post'
  })
}

export const deleteTablemsg = (token, param) => {
  const data = {param}
  const type = param.type
  return axios.request({
    url: '/archives/delete/' + type,
    data,
    method: 'post'
  })
}
export const getSearchMsg = (token, param) => {
  var data = {param}
  return axios.request({
    url: '/project/task',
    data,
    method: 'post'
  })
}
export const getaskSearchMsg = (token, param) => {
  var data = {param}
  return axios.request({
    url: '/project/issue',
    data,
    method: 'post'
  })
}

export const getExpiretaskMsg = (token, param) => {
  var data = {param}
  const type = param.type
  return axios.request({
    url: '/project/alarm/' + type,
    data,
    method: 'post'
  })
}

export const addTaskTablemsg = (token, param) => {
  debugger
  var data = {param}
  const type = param.type
  return axios.request({
    url: '/project/update/' + type,
    data,
    method: 'post'
  })
}